/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.*;

/**
 *
 * @author alexcarpentieri
 */
@Stateless
public class FilmBean implements FilmBeanLocal{
    @PersistenceContext
     private EntityManager em;
     
    @Override
    public void insertFilm(FilmEntity film) {
        em.persist(film);
    }
    @Override
    public List<FilmEntity> findByTitolo(String titolo){
        
        return em.createQuery("select object(o) from FilmEntity as o where o.titolo LIKE 'alex%' ").getResultList();// where titolo ='"+titolo+"' ").getResultList();
        
    }
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
    
}
